package com.kmzx.one.project.others.dto;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import me.chanjar.weixin.common.util.xml.XStreamInitializer;

import java.io.Serializable;

@XStreamAlias("xml")
@Getter
@Setter
@Accessors(chain = true)
@ToString
public class WikiPayRequest implements Serializable {


    // 公众账号ID
    @XStreamAlias("appid")
    private String appid;
    // 商户号
    @XStreamAlias("mch_id")
    private String mch_id;
    // 随机字符串
    @XStreamAlias("nonce_str")
    private String nonce_str;
    // 签名
    @XStreamAlias("sign")
    private String sign;
    // 商品描述
    @XStreamAlias("body")
    private String body;
    // 商户订单号
    @XStreamAlias("out_trade_no")
    private String out_trade_no;
    // 货币类型
//    @XStreamAlias("fee_type")
//    private String fee_type = "CNY";
    // 总金额
    @XStreamAlias("total_fee")
    private Integer total_fee;
    // 终端IP
    @XStreamAlias("spbill_create_ip")
    private String spbill_create_ip;
    // 通知地址
    @XStreamAlias("notify_url")
    private String notify_url;
    // 交易类型 H5支付的交易类型为MWEB
    @XStreamAlias("trade_type")
    private String trade_type = "MWEB";
    // 场景信息 {"h5_info": {"type":"IOS","app_name": "王者荣耀","package_name": "com.tencent.tmgp.sgame"}}
    @XStreamAlias("scene_info")
    private String scene_info;

    public String toXML() {
        XStream xstream = XStreamInitializer.getInstance();
        xstream.processAnnotations(this.getClass());
        return xstream.toXML(this);
    }

}
